/* Replication Stata Do-File: Figure 2, 3; Table 3, 4, 5, 6; Appendix D, E, F */


/* Dataset */
clear
use "D:\03 Data 1.dta"
save "D:\temp.dta", replace

*******************************************************************
/* Figure 2 & Appendix E*/
clear
use "D:\temp.dta"

/* Overall qualty of public services */
tab q3_1 merger, col chi2

/* User-friendliness of the municipal office building */
tab q3_2 merger, col chi2

/* Efficiency of the municipal office */
tab q3_3 merger, col chi2

/* Easiness to consult with assembly members */
tab q3_4 merger, col chi2

/* Easiness to consult with mayor */
tab q3_5 merger, col chi2

/* User-friendliness of public facilities */
tab q3_6 merger, col chi2

/* Construction and maintenance of roads */
tab q3_7 merger, col chi2

/* <== I used these results to construct the figure in Excel */

*******************************************************************
/* Table 3 & Appendix D */
clear
use "D:\temp.dta"

/* Male Female */
lab var q19_1 "Gender  1. Male, 2. Female, 3. Don't want to answer"
tab q19_1 merger, col chi2

/* Age */
lab var q19_2 "Age group - "
tab q19_2 merger, col chi2

/* Employment */
lab var q19_3 "Employment  1. Yes   2. No   3. Don't want to answer"
tab q19_3 merger, col chi2

/* Year of residence */
lab var q19_7 "Year of residence  0. Less than 1,  15. More than 15 years,  100. Don't want to answer"
tab q19_7 merger, col chi2

/* Income */
lab var q19_6 "Income   1. Lowest (< 2 million), 8. Highest (> 14 million)   9. Don't want to answer"
tab q19_6 merger, col chi2


*******************************************************************
/* Table 4 (1) */
clear
use "D:\temp.dta"

/* Overall qualty of public services */
mlogit q3_1 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_1!=4

/* User-friendliness of the municipal office building */
mlogit q3_2 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_2!=4

/* Efficiency of the municipal office */
mlogit q3_3 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_3!=4

/* Easiness to consult with assembly members */
mlogit q3_4 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_4!=4

/* Easiness to consult with mayor */
mlogit q3_5 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_5!=4

/* User-friendliness of public facilities */
mlogit q3_6 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_6!=4

/* Construction and maintenance of roads */
mlogit q3_7 merger female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_7!=4



/* Table 4 (2) */
clear
use "D:\temp.dta"

/* Overall quality of public services */
clear
use "D:\temp.dta"
estsimp mlogit q3_1 merger female age_group employed  I2-I9  if age_group!=10  & q3_1!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

/* User-friendliness of the municipal office building */
clear
use "D:\temp.dta"
estsimp mlogit q3_2 merger female age_group employed  I2-I9  if age_group!=10  & q3_2!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

/* Efficiency of the municipal office */
clear
use "D:\temp.dta"
estsimp mlogit q3_3 merger female age_group employed  I2-I9  if age_group!=10  & q3_3!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

/* Easiness to consult with assembly members */
clear
use "D:\temp.dta"
estsimp mlogit q3_4 merger female age_group employed  I2-I9  if age_group!=10  & q3_4!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

/* Easiness to consult with mayor */
clear
use "D:\temp.dta"
estsimp mlogit q3_5 merger female age_group employed  I2-I9  if age_group!=10  & q3_5!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

/* User-friendliness of public facilities */
clear
use "D:\temp.dta"
estsimp mlogit q3_6 merger female age_group employed  I2-I9  if age_group!=10  & q3_6!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

/* Construction and maintenance of roads	*/ 
clear
use "D:\temp.dta"
estsimp mlogit q3_7 merger female age_group employed  I2-I9  if age_group!=10  & q3_7!=4 & more_than_10==1 
setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 
setx merger 0
simqi, fd(prval(1)) changex(merger 0 1)
simqi, fd(prval(2)) changex(merger 0 1)
simqi, fd(prval(3)) changex(merger 0 1)

*******************************************************************

/* Table 5 */
clear
use "D:\temp.dta"

/* Overall qualty of public services */
mlogit q3_1 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_1!=4

/* User-friendliness of the municipal office building */
mlogit q3_2 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_2!=4

/* Efficiency of the municipal office */
mlogit q3_3 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_3!=4

/* Easiness to consult with assembly members */
mlogit q3_4 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_4!=4

/* Easiness to consult with mayor */
mlogit q3_5 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_5!=4

/* User-friendliness of public facilities */
mlogit q3_6 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_6!=4

/* Construction and maintenance of roads */
mlogit q3_7 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_7!=4

*******************************************************************
/* Figure 3 */

/* Overall quality of public services */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_1 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & q3_1!=4 & more_than_10==1 

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)

/* User-friendliness of the municipal office building */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_2 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_2!=4

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)

/* Efficiency of the municipal office */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_3 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_3!=4

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)

/* Easiness to consult with assembly members */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_4 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_4!=4

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)

/* Easiness to consult with mayor */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_5 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_5!=4

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)


/* User-friendliness of public facilities */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_6 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_6!=4

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)

/* Construction and maintenance of roads */
clear
use "D:\temp.dta"
set more off
estsimp mlogit q3_7 Q1 Q2 Q3 female age_group  employed  I2-I9 if age_group!=10  & more_than_10==1 & q3_7!=4

setx female 1
setx age_group 6
setx employed 1
setx I2 1
setx I3 0 I4 0 I5 0 I6 0 I7 0 I8 0 I9 0 

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q1 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q2 0 1)

setx Q1 0 Q2 0 Q3 0
simqi, fd(prval(1)) changex(Q3 0 1)


/* <== I used these results to construct the figure in Excel */


*******************************************************************
/* Appendix F */
clear
use "D:\temp.dta"

/* Today */
tab q7 merger, col chi2

/* 10 years ago */
tab q8 merger, col chi2

/* <== I used these results to construct the table in Excel */
